package com.all.security.mapper;

import com.all.security.model.entity.SysUserRole;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 用户和角色关联表 Mapper 接口
 * </p>
 *
 * @author ly
 * @since 2024-03-31
 */
public interface SysUserRoleMapper extends BaseMapper<SysUserRole> {

    @Select("select sr.role_key as roleName from sys_user_role sur " +
            "join sys_role sr on sur.role_id = sr.role_id " +
            "where sr.status = 0 and sr.del_flag = 0 and sur.user_id = #{userId}")
    List<String> getSysUserPerms(@Param("userId") Long userId);;
}
